<?php session_start(); ?>
<?php 
session_start(); // Initialize session data
ob_start(); // Turn on output buffering
?>
<?php 
//include "ewcfg50.php" ;
//include "ewmysql50.php" ;
//include "phpfn50.php" ;
//include "userfn50.php" 
?>

<?php
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // Always modified
header("Cache-Control: private, no-store, no-cache, must-revalidate"); // HTTP/1.1 
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache"); // HTTP/1.0
?>
<?php
$Security = new cAdvancedSecurity();
?>
<?php
if (!$Security->IsLoggedIn()) $Security->AutoLogin();
if (!$Security->IsLoggedIn()) {
	$Security->SaveLastUrl();
	header("Location: login.php");
	exit();
}
?>
<?php require_once('Connections/MYCONN.php'); 

if (!function_exists("GetSQLValueString")) {

function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}


function PrintHeader($ID, $database_MYCONN, $MYCONN){
	$ID_Recordset1 = "0";
	if (isset($ID)) {
	  $ID_Recordset1 = (get_magic_quotes_gpc()) ? $ID : addslashes($ID);
	}
	mysql_select_db($database_MYCONN, $MYCONN);
	$query_Recordset1 = sprintf("select DISTINCT ID, LogDate, UserName, RegisterID from view_daily_activity WHERE ID = ".GetSQLValueString($ID_Recordset1, "int"));
	$Recordset1 = mysql_query($query_Recordset1, $MYCONN) or die(mysql_error());
	$row_Recordset1 = mysql_fetch_assoc($Recordset1);
	$totalRows_Recordset1 = mysql_num_rows($Recordset1);
	

echo "<table border='1' class='report'>";
do { 
	echo "<tr>";
	  echo "<td> Log Date : ".$row_Recordset1['LogDate']."</td>";
	  echo "<td> User Name : ".$row_Recordset1['UserName']."</td>";
	  echo "<td> Register : ".$row_Recordset1['RegisterID']."</td>";
    echo "</tr>";
} while ($row_Recordset1 = mysql_fetch_assoc($Recordset1));
echo "</table>";
mysql_free_result($Recordset1);
}

function getUserAdmin($User, $database_MYCONN, $MYCONN){
	$userlevel=0;
	
	//878-2284555

	if (isset($User)) {
	  $User = (get_magic_quotes_gpc()) ? $User : addslashes($User);
	}
	
	mysql_select_db($database_MYCONN, $MYCONN);

	$query_Recordset1 = "select distinct UserGroup from tb_Users where UserName = '".$User."' ";

	//echo $query_Recordset1;

	$Recordset1 = mysql_query($query_Recordset1, $MYCONN) or die(mysql_error());
	$row_Recordset1 = mysql_fetch_assoc($Recordset1);
	$totalRows_Recordset1 = mysql_num_rows($Recordset1);
	do 
	{ 
		$userlevel = $row_Recordset1['UserGroup'];
	} while ($row_Recordset1 = mysql_fetch_assoc($Recordset1));

	mysql_free_result($Recordset1);

	if($userlevel == "" || $userlevel == null)
	{
		$userlevel = 0;
	}

return $userlevel;

}


?>

<?php 
// PrintHeader(2770, $database_MYCONN, $MYCONN);
// echo getUserAdmin('genuser', $database_MYCONN, $MYCONN);
?>